/**
 * <copyright>
 *
 * Copyright (c) 2011 Zeligsoft (2009) Limited
 * All rights reserved.   This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors: 
 *   Zeligsoft (2009) Limited - Initial API and implementation
 *
 * </copyright>
 *
 */
package org.omg.deployment.impl;

import java.lang.reflect.InvocationTargetException;
import java.util.Collection;

import javax.xml.namespace.QName;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.ECollections;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.emf.ecore.util.BasicFeatureMap;
import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.InternalEList;
import org.omg.deployment.ArtifactDeploymentDescription;
import org.omg.deployment.ComponentInterfaceDescription;
import org.omg.deployment.DeploymentPackage;
import org.omg.deployment.DeploymentPlan;
import org.omg.deployment.ImplementationDependency;
import org.omg.deployment.InstanceDeploymentDescription;
import org.omg.deployment.MonolithicDeploymentDescription;
import org.omg.deployment.PlanConnectionDescription;
import org.omg.deployment.PlanLocality;
import org.omg.deployment.PlanPropertyMapping;
import org.omg.deployment.Property;
import org.omg.xmi.Extension;

import com.google.common.base.Preconditions;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Plan</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.omg.deployment.impl.DeploymentPlanImpl#getGroup <em>Group</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DeploymentPlanImpl#getLabel <em>Label</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DeploymentPlanImpl#getUUID <em>UUID</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DeploymentPlanImpl#getRealizes <em>Realizes</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DeploymentPlanImpl#getImplementation <em>Implementation</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DeploymentPlanImpl#getInstance <em>Instance</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DeploymentPlanImpl#getConnection <em>Connection</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DeploymentPlanImpl#getExternalProperty <em>External Property</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DeploymentPlanImpl#getDependsOn <em>Depends On</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DeploymentPlanImpl#getArtifact <em>Artifact</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DeploymentPlanImpl#getInfoProperty <em>Info Property</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DeploymentPlanImpl#getLocalityConstraint <em>Locality Constraint</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DeploymentPlanImpl#getExtension <em>Extension</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DeploymentPlanImpl#getHref <em>Href</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DeploymentPlanImpl#getId <em>Id</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DeploymentPlanImpl#getIdref <em>Idref</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DeploymentPlanImpl#getType <em>Type</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DeploymentPlanImpl#getVersion <em>Version</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DeploymentPlanImpl#getNumImplementation <em>Num Implementation</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DeploymentPlanImpl#getNumInstance <em>Num Instance</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DeploymentPlanImpl#getNumConnection <em>Num Connection</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DeploymentPlanImpl#getNumArtifact <em>Num Artifact</em>}</li>
 *   <li>{@link org.omg.deployment.impl.DeploymentPlanImpl#getNumLocalityConstraint <em>Num Locality Constraint</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class DeploymentPlanImpl extends EObjectImpl implements DeploymentPlan {
	/**
	 * The cached value of the '{@link #getGroup() <em>Group</em>}' attribute list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getGroup()
	 * @generated
	 * @ordered
	 */
	protected FeatureMap group;

	/**
	 * The default value of the '{@link #getLabel() <em>Label</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLabel()
	 * @generated
	 * @ordered
	 */
	protected static final String LABEL_EDEFAULT = null;

	/**
	 * The default value of the '{@link #getUUID() <em>UUID</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getUUID()
	 * @generated
	 * @ordered
	 */
	protected static final String UUID_EDEFAULT = null;

	/**
	 * The default value of the '{@link #getHref() <em>Href</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getHref()
	 * @generated
	 * @ordered
	 */
	protected static final String HREF_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getHref() <em>Href</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getHref()
	 * @generated
	 * @ordered
	 */
	protected String href = HREF_EDEFAULT;

	/**
	 * The default value of the '{@link #getId() <em>Id</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getId()
	 * @generated
	 * @ordered
	 */
	protected static final String ID_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getId() <em>Id</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getId()
	 * @generated
	 * @ordered
	 */
	protected String id = ID_EDEFAULT;

	/**
	 * The default value of the '{@link #getIdref() <em>Idref</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getIdref()
	 * @generated
	 * @ordered
	 */
	protected static final String IDREF_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getIdref() <em>Idref</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getIdref()
	 * @generated
	 * @ordered
	 */
	protected String idref = IDREF_EDEFAULT;

	/**
	 * The default value of the '{@link #getType() <em>Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getType()
	 * @generated
	 * @ordered
	 */
	protected static final QName TYPE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getType() <em>Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getType()
	 * @generated
	 * @ordered
	 */
	protected QName type = TYPE_EDEFAULT;

	/**
	 * The default value of the '{@link #getVersion() <em>Version</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getVersion()
	 * @generated
	 * @ordered
	 */
	protected static final String VERSION_EDEFAULT = "2.1";

	/**
	 * The cached value of the '{@link #getVersion() <em>Version</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getVersion()
	 * @generated
	 * @ordered
	 */
	protected String version = VERSION_EDEFAULT;

	/**
	 * This is true if the Version attribute has been set.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 * @ordered
	 */
	protected boolean versionESet;

	/**
	 * The default value of the '{@link #getNumImplementation() <em>Num Implementation</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNumImplementation()
	 * @generated
	 * @ordered
	 */
	protected static final long NUM_IMPLEMENTATION_EDEFAULT = 0L;

	/**
	 * The default value of the '{@link #getNumInstance() <em>Num Instance</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNumInstance()
	 * @generated
	 * @ordered
	 */
	protected static final long NUM_INSTANCE_EDEFAULT = 0L;

	/**
	 * The default value of the '{@link #getNumConnection() <em>Num Connection</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNumConnection()
	 * @generated
	 * @ordered
	 */
	protected static final long NUM_CONNECTION_EDEFAULT = 0L;

	/**
	 * The default value of the '{@link #getNumArtifact() <em>Num Artifact</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNumArtifact()
	 * @generated
	 * @ordered
	 */
	protected static final long NUM_ARTIFACT_EDEFAULT = 0L;

	/**
	 * The default value of the '{@link #getNumLocalityConstraint() <em>Num Locality Constraint</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNumLocalityConstraint()
	 * @generated
	 * @ordered
	 */
	protected static final long NUM_LOCALITY_CONSTRAINT_EDEFAULT = 0L;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected DeploymentPlanImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return DeploymentPackage.eINSTANCE.getDeploymentPlan();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public FeatureMap getGroup() {
		if (group == null) {
			group = new BasicFeatureMap(this,
					DeploymentPackage.DEPLOYMENT_PLAN__GROUP);
		}
		return group;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getLabel() {
		return (String) getGroup().get(
				DeploymentPackage.eINSTANCE.getDeploymentPlan_Label(), true);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setLabel(String newLabel) {
		((FeatureMap.Internal) getGroup())
				.set(DeploymentPackage.eINSTANCE.getDeploymentPlan_Label(),
						newLabel);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getUUID() {
		return (String) getGroup().get(
				DeploymentPackage.eINSTANCE.getDeploymentPlan_UUID(), true);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setUUID(String newUUID) {
		((FeatureMap.Internal) getGroup()).set(
				DeploymentPackage.eINSTANCE.getDeploymentPlan_UUID(), newUUID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ComponentInterfaceDescription getRealizes() {
		return (ComponentInterfaceDescription) getGroup().get(
				DeploymentPackage.eINSTANCE.getDeploymentPlan_Realizes(), true);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetRealizes(
			ComponentInterfaceDescription newRealizes, NotificationChain msgs) {
		return ((FeatureMap.Internal) getGroup()).basicAdd(
				DeploymentPackage.eINSTANCE.getDeploymentPlan_Realizes(),
				newRealizes, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRealizes(ComponentInterfaceDescription newRealizes) {
		((FeatureMap.Internal) getGroup()).set(
				DeploymentPackage.eINSTANCE.getDeploymentPlan_Realizes(),
				newRealizes);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<MonolithicDeploymentDescription> getImplementation() {
		return getGroup().list(
				DeploymentPackage.eINSTANCE.getDeploymentPlan_Implementation());
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<InstanceDeploymentDescription> getInstance() {
		return getGroup().list(
				DeploymentPackage.eINSTANCE.getDeploymentPlan_Instance());
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<PlanConnectionDescription> getConnection() {
		return getGroup().list(
				DeploymentPackage.eINSTANCE.getDeploymentPlan_Connection());
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<PlanPropertyMapping> getExternalProperty() {
		return getGroup().list(
				DeploymentPackage.eINSTANCE
						.getDeploymentPlan_ExternalProperty());
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<ImplementationDependency> getDependsOn() {
		return getGroup().list(
				DeploymentPackage.eINSTANCE.getDeploymentPlan_DependsOn());
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<ArtifactDeploymentDescription> getArtifact() {
		return getGroup().list(
				DeploymentPackage.eINSTANCE.getDeploymentPlan_Artifact());
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Property> getInfoProperty() {
		return getGroup().list(
				DeploymentPackage.eINSTANCE.getDeploymentPlan_InfoProperty());
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<PlanLocality> getLocalityConstraint() {
		return getGroup().list(
				DeploymentPackage.eINSTANCE
						.getDeploymentPlan_LocalityConstraint());
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Extension> getExtension() {
		return getGroup().list(
				DeploymentPackage.eINSTANCE.getDeploymentPlan_Extension());
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getHref() {
		return href;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setHref(String newHref) {
		String oldHref = href;
		href = newHref;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET,
					DeploymentPackage.DEPLOYMENT_PLAN__HREF, oldHref, href));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getId() {
		return id;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setId(String newId) {
		String oldId = id;
		id = newId;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET,
					DeploymentPackage.DEPLOYMENT_PLAN__ID, oldId, id));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getIdref() {
		return idref;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setIdref(String newIdref) {
		String oldIdref = idref;
		idref = newIdref;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET,
					DeploymentPackage.DEPLOYMENT_PLAN__IDREF, oldIdref, idref));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public QName getType() {
		return type;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setType(QName newType) {
		QName oldType = type;
		type = newType;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET,
					DeploymentPackage.DEPLOYMENT_PLAN__TYPE, oldType, type));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getVersion() {
		return version;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setVersion(String newVersion) {
		String oldVersion = version;
		version = newVersion;
		boolean oldVersionESet = versionESet;
		versionESet = true;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET,
					DeploymentPackage.DEPLOYMENT_PLAN__VERSION, oldVersion,
					version, !oldVersionESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void unsetVersion() {
		String oldVersion = version;
		boolean oldVersionESet = versionESet;
		version = VERSION_EDEFAULT;
		versionESet = false;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.UNSET,
					DeploymentPackage.DEPLOYMENT_PLAN__VERSION, oldVersion,
					VERSION_EDEFAULT, oldVersionESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isSetVersion() {
		return versionESet;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public long getNumImplementation() {
		long result = 0;
		if (this.getImplementation() != null) {
			result = getImplementation().size();
		}
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public long getNumInstance() {
		long result = 0;
		if (this.getInstance() != null) {
			result = getInstance().size();
		}

		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public long getNumConnection() {
		long result = 0;
		if (this.getConnection() != null) {
			result = getConnection().size();
		}

		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public long getNumArtifact() {
		long result = 0;
		if (this.getArtifact() != null) {
			result = getArtifact().size();
		}

		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public long getNumLocalityConstraint() {
		long result = 0;
		if (this.getLocalityConstraint() != null) {
			result = getLocalityConstraint().size();
		}

		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public EList<ArtifactDeploymentDescription> findArtifact(String id) {
		EList<ArtifactDeploymentDescription> result = new BasicEList<ArtifactDeploymentDescription>();
		for (ArtifactDeploymentDescription next : this.getArtifact()) {
			if ((next.getId() != null && next.getId().equals(id))
					|| (next.getName() != null && next.getName().equals(id))) {
				result.add(next);
			}
		}

		return ECollections.unmodifiableEList(result);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public InstanceDeploymentDescription findInstance(String id) {
		Preconditions.checkNotNull(id);

		InstanceDeploymentDescription result = null;

		for (InstanceDeploymentDescription next : getInstance()) {
			if (next.getId() != null && next.getId().equals(id)) {
				result = next;
				break;
			}
		}

		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public MonolithicDeploymentDescription findImplementation(String id) {
		Preconditions.checkNotNull(id);

		MonolithicDeploymentDescription result = null;

		for (MonolithicDeploymentDescription next : getImplementation()) {
			if (next.getId() != null && next.getId().equals(id)) {
				result = next;
				break;
			}
		}

		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd,
			int featureID, NotificationChain msgs) {
		switch (featureID) {
		case DeploymentPackage.DEPLOYMENT_PLAN__GROUP:
			return ((InternalEList<?>) getGroup()).basicRemove(otherEnd, msgs);
		case DeploymentPackage.DEPLOYMENT_PLAN__REALIZES:
			return basicSetRealizes(null, msgs);
		case DeploymentPackage.DEPLOYMENT_PLAN__IMPLEMENTATION:
			return ((InternalEList<?>) getImplementation()).basicRemove(
					otherEnd, msgs);
		case DeploymentPackage.DEPLOYMENT_PLAN__INSTANCE:
			return ((InternalEList<?>) getInstance()).basicRemove(otherEnd,
					msgs);
		case DeploymentPackage.DEPLOYMENT_PLAN__CONNECTION:
			return ((InternalEList<?>) getConnection()).basicRemove(otherEnd,
					msgs);
		case DeploymentPackage.DEPLOYMENT_PLAN__EXTERNAL_PROPERTY:
			return ((InternalEList<?>) getExternalProperty()).basicRemove(
					otherEnd, msgs);
		case DeploymentPackage.DEPLOYMENT_PLAN__DEPENDS_ON:
			return ((InternalEList<?>) getDependsOn()).basicRemove(otherEnd,
					msgs);
		case DeploymentPackage.DEPLOYMENT_PLAN__ARTIFACT:
			return ((InternalEList<?>) getArtifact()).basicRemove(otherEnd,
					msgs);
		case DeploymentPackage.DEPLOYMENT_PLAN__INFO_PROPERTY:
			return ((InternalEList<?>) getInfoProperty()).basicRemove(otherEnd,
					msgs);
		case DeploymentPackage.DEPLOYMENT_PLAN__LOCALITY_CONSTRAINT:
			return ((InternalEList<?>) getLocalityConstraint()).basicRemove(
					otherEnd, msgs);
		case DeploymentPackage.DEPLOYMENT_PLAN__EXTENSION:
			return ((InternalEList<?>) getExtension()).basicRemove(otherEnd,
					msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
		case DeploymentPackage.DEPLOYMENT_PLAN__GROUP:
			if (coreType)
				return getGroup();
			return ((FeatureMap.Internal) getGroup()).getWrapper();
		case DeploymentPackage.DEPLOYMENT_PLAN__LABEL:
			return getLabel();
		case DeploymentPackage.DEPLOYMENT_PLAN__UUID:
			return getUUID();
		case DeploymentPackage.DEPLOYMENT_PLAN__REALIZES:
			return getRealizes();
		case DeploymentPackage.DEPLOYMENT_PLAN__IMPLEMENTATION:
			return getImplementation();
		case DeploymentPackage.DEPLOYMENT_PLAN__INSTANCE:
			return getInstance();
		case DeploymentPackage.DEPLOYMENT_PLAN__CONNECTION:
			return getConnection();
		case DeploymentPackage.DEPLOYMENT_PLAN__EXTERNAL_PROPERTY:
			return getExternalProperty();
		case DeploymentPackage.DEPLOYMENT_PLAN__DEPENDS_ON:
			return getDependsOn();
		case DeploymentPackage.DEPLOYMENT_PLAN__ARTIFACT:
			return getArtifact();
		case DeploymentPackage.DEPLOYMENT_PLAN__INFO_PROPERTY:
			return getInfoProperty();
		case DeploymentPackage.DEPLOYMENT_PLAN__LOCALITY_CONSTRAINT:
			return getLocalityConstraint();
		case DeploymentPackage.DEPLOYMENT_PLAN__EXTENSION:
			return getExtension();
		case DeploymentPackage.DEPLOYMENT_PLAN__HREF:
			return getHref();
		case DeploymentPackage.DEPLOYMENT_PLAN__ID:
			return getId();
		case DeploymentPackage.DEPLOYMENT_PLAN__IDREF:
			return getIdref();
		case DeploymentPackage.DEPLOYMENT_PLAN__TYPE:
			return getType();
		case DeploymentPackage.DEPLOYMENT_PLAN__VERSION:
			return getVersion();
		case DeploymentPackage.DEPLOYMENT_PLAN__NUM_IMPLEMENTATION:
			return getNumImplementation();
		case DeploymentPackage.DEPLOYMENT_PLAN__NUM_INSTANCE:
			return getNumInstance();
		case DeploymentPackage.DEPLOYMENT_PLAN__NUM_CONNECTION:
			return getNumConnection();
		case DeploymentPackage.DEPLOYMENT_PLAN__NUM_ARTIFACT:
			return getNumArtifact();
		case DeploymentPackage.DEPLOYMENT_PLAN__NUM_LOCALITY_CONSTRAINT:
			return getNumLocalityConstraint();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
		case DeploymentPackage.DEPLOYMENT_PLAN__GROUP:
			((FeatureMap.Internal) getGroup()).set(newValue);
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__LABEL:
			setLabel((String) newValue);
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__UUID:
			setUUID((String) newValue);
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__REALIZES:
			setRealizes((ComponentInterfaceDescription) newValue);
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__IMPLEMENTATION:
			getImplementation().clear();
			getImplementation()
					.addAll((Collection<? extends MonolithicDeploymentDescription>) newValue);
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__INSTANCE:
			getInstance().clear();
			getInstance()
					.addAll((Collection<? extends InstanceDeploymentDescription>) newValue);
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__CONNECTION:
			getConnection().clear();
			getConnection().addAll(
					(Collection<? extends PlanConnectionDescription>) newValue);
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__EXTERNAL_PROPERTY:
			getExternalProperty().clear();
			getExternalProperty().addAll(
					(Collection<? extends PlanPropertyMapping>) newValue);
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__DEPENDS_ON:
			getDependsOn().clear();
			getDependsOn().addAll(
					(Collection<? extends ImplementationDependency>) newValue);
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__ARTIFACT:
			getArtifact().clear();
			getArtifact()
					.addAll((Collection<? extends ArtifactDeploymentDescription>) newValue);
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__INFO_PROPERTY:
			getInfoProperty().clear();
			getInfoProperty().addAll((Collection<? extends Property>) newValue);
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__LOCALITY_CONSTRAINT:
			getLocalityConstraint().clear();
			getLocalityConstraint().addAll(
					(Collection<? extends PlanLocality>) newValue);
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__EXTENSION:
			getExtension().clear();
			getExtension().addAll((Collection<? extends Extension>) newValue);
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__HREF:
			setHref((String) newValue);
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__ID:
			setId((String) newValue);
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__IDREF:
			setIdref((String) newValue);
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__TYPE:
			setType((QName) newValue);
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__VERSION:
			setVersion((String) newValue);
			return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
		case DeploymentPackage.DEPLOYMENT_PLAN__GROUP:
			getGroup().clear();
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__LABEL:
			setLabel(LABEL_EDEFAULT);
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__UUID:
			setUUID(UUID_EDEFAULT);
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__REALIZES:
			setRealizes((ComponentInterfaceDescription) null);
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__IMPLEMENTATION:
			getImplementation().clear();
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__INSTANCE:
			getInstance().clear();
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__CONNECTION:
			getConnection().clear();
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__EXTERNAL_PROPERTY:
			getExternalProperty().clear();
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__DEPENDS_ON:
			getDependsOn().clear();
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__ARTIFACT:
			getArtifact().clear();
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__INFO_PROPERTY:
			getInfoProperty().clear();
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__LOCALITY_CONSTRAINT:
			getLocalityConstraint().clear();
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__EXTENSION:
			getExtension().clear();
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__HREF:
			setHref(HREF_EDEFAULT);
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__ID:
			setId(ID_EDEFAULT);
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__IDREF:
			setIdref(IDREF_EDEFAULT);
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__TYPE:
			setType(TYPE_EDEFAULT);
			return;
		case DeploymentPackage.DEPLOYMENT_PLAN__VERSION:
			unsetVersion();
			return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
		case DeploymentPackage.DEPLOYMENT_PLAN__GROUP:
			return group != null && !group.isEmpty();
		case DeploymentPackage.DEPLOYMENT_PLAN__LABEL:
			return LABEL_EDEFAULT == null ? getLabel() != null
					: !LABEL_EDEFAULT.equals(getLabel());
		case DeploymentPackage.DEPLOYMENT_PLAN__UUID:
			return UUID_EDEFAULT == null ? getUUID() != null : !UUID_EDEFAULT
					.equals(getUUID());
		case DeploymentPackage.DEPLOYMENT_PLAN__REALIZES:
			return getRealizes() != null;
		case DeploymentPackage.DEPLOYMENT_PLAN__IMPLEMENTATION:
			return !getImplementation().isEmpty();
		case DeploymentPackage.DEPLOYMENT_PLAN__INSTANCE:
			return !getInstance().isEmpty();
		case DeploymentPackage.DEPLOYMENT_PLAN__CONNECTION:
			return !getConnection().isEmpty();
		case DeploymentPackage.DEPLOYMENT_PLAN__EXTERNAL_PROPERTY:
			return !getExternalProperty().isEmpty();
		case DeploymentPackage.DEPLOYMENT_PLAN__DEPENDS_ON:
			return !getDependsOn().isEmpty();
		case DeploymentPackage.DEPLOYMENT_PLAN__ARTIFACT:
			return !getArtifact().isEmpty();
		case DeploymentPackage.DEPLOYMENT_PLAN__INFO_PROPERTY:
			return !getInfoProperty().isEmpty();
		case DeploymentPackage.DEPLOYMENT_PLAN__LOCALITY_CONSTRAINT:
			return !getLocalityConstraint().isEmpty();
		case DeploymentPackage.DEPLOYMENT_PLAN__EXTENSION:
			return !getExtension().isEmpty();
		case DeploymentPackage.DEPLOYMENT_PLAN__HREF:
			return HREF_EDEFAULT == null ? href != null : !HREF_EDEFAULT
					.equals(href);
		case DeploymentPackage.DEPLOYMENT_PLAN__ID:
			return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
		case DeploymentPackage.DEPLOYMENT_PLAN__IDREF:
			return IDREF_EDEFAULT == null ? idref != null : !IDREF_EDEFAULT
					.equals(idref);
		case DeploymentPackage.DEPLOYMENT_PLAN__TYPE:
			return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT
					.equals(type);
		case DeploymentPackage.DEPLOYMENT_PLAN__VERSION:
			return isSetVersion();
		case DeploymentPackage.DEPLOYMENT_PLAN__NUM_IMPLEMENTATION:
			return getNumImplementation() != NUM_IMPLEMENTATION_EDEFAULT;
		case DeploymentPackage.DEPLOYMENT_PLAN__NUM_INSTANCE:
			return getNumInstance() != NUM_INSTANCE_EDEFAULT;
		case DeploymentPackage.DEPLOYMENT_PLAN__NUM_CONNECTION:
			return getNumConnection() != NUM_CONNECTION_EDEFAULT;
		case DeploymentPackage.DEPLOYMENT_PLAN__NUM_ARTIFACT:
			return getNumArtifact() != NUM_ARTIFACT_EDEFAULT;
		case DeploymentPackage.DEPLOYMENT_PLAN__NUM_LOCALITY_CONSTRAINT:
			return getNumLocalityConstraint() != NUM_LOCALITY_CONSTRAINT_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eInvoke(int operationID, EList<?> arguments)
			throws InvocationTargetException {
		switch (operationID) {
		case DeploymentPackage.DEPLOYMENT_PLAN___FIND_ARTIFACT__STRING:
			return findArtifact((String) arguments.get(0));
		case DeploymentPackage.DEPLOYMENT_PLAN___FIND_INSTANCE__STRING:
			return findInstance((String) arguments.get(0));
		case DeploymentPackage.DEPLOYMENT_PLAN___FIND_IMPLEMENTATION__STRING:
			return findImplementation((String) arguments.get(0));
		}
		return super.eInvoke(operationID, arguments);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy())
			return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (group: ");
		result.append(group);
		result.append(", href: ");
		result.append(href);
		result.append(", id: ");
		result.append(id);
		result.append(", idref: ");
		result.append(idref);
		result.append(", type: ");
		result.append(type);
		result.append(", version: ");
		if (versionESet)
			result.append(version);
		else
			result.append("<unset>");
		result.append(')');
		return result.toString();
	}

} //DeploymentPlanImpl
